--[[

	Contributed by Wopak.
	Used for ccR.Spell.IsInRange

]]
function fawGetSpellIndex(spell)
	if spell == nil then return 0; end
	if tonumber(spell) ~= nil then spell = GetSpellInfo(spell) end
	local myIndex = nil;
	local myBook = nil;
	local _, _, offset, numSpells, _, _ = GetSpellTabInfo(2);
	for thisIndex = offset+1, numSpells+offset do
		if spell == GetSpellBookItemName(thisIndex, "spell") then
			myIndex = thisIndex;
			myBook = "spell";
			break
		end
	end
	local numPetSpells = HasPetSpells();
	if not myIndex and numPetSpells then
		for thisIndex = 1, numPetSpells do
			if spell == GetSpellBookItemName(thisIndex, "pet") then
				myIndex = thisIndex;
				myBook = "pet";
				break
			end
		end
	end
	return myIndex, myBook;
end